home *** CD-ROM | disk | FTP | other *** search
- Path: chronicle.mti.sgi.com!austern
- From: clamage@Eng.Sun.COM (Steve Clamage)
- Newsgroups: comp.std.c++
- Subject: Re: Defining object in function call
- Date: 16 Jan 1996 10:05:23 PST
- Organization: Sun Microsystems Inc., Mountain View, CA
- Approved: austern@isolde.mti.sgi.com
- Message-ID: <4df1eo$7oj@engnews1.Eng.Sun.COM>
- References: <4de4lg$mfu@darkstar.UCSC.EDU>
- NNTP-Posting-Host: isolde.mti.sgi.com
- X-Original-Date: 16 Jan 1996 02:10:32 GMT
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBVAwUBMPvo9ky4NqrwXLNJAQHmbQH/X/Q1RotWJBRNk/lifFGgmgc9i1qdlANR
- 4YLJg/st0gcqeivA+DK0U5sUsgApz3SC2GMQihRr4ty+YA1xiyLY7A==
- =uoDS
- Originator: austern@isolde.mti.sgi.com
-
- ray@cse.ucsc.edu (Ray Swartz) writes:
-
- >I read somewhere (this newsgroup, I think) that the limitation on
- >defining variables/objects in function calls had been lifted.
-
- >I tried to find this in the April WP but failed.
-
- If you mean something like
-
- void foo(int);
-
- main()
- {
- foo(int i = 12); // valid?
-
- that has never been allowed as a function call. (The example is
- a valid construct, but it re-declares 'foo' to have a default
- argument of value 12. It is not a function call.)
- This example shows one reason why it isn't allowed: ambiguity.
-
- A function call contains a list of expressions, and an expression
- cannot contain a variable definition. (The "condition" part of a
- selection statement or loop may now contain a variable definition,
- but those are not expressions.)
-
- --
- Steve Clamage, stephen.clamage@eng.sun.com
- ---
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
- is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
-